package com.zl.smartmall.library.po;


import com.zl.smartmall.library.account.IAuth;

import net.tsz.afinal.annotation.sqlite.Id;
import net.tsz.afinal.annotation.sqlite.Property;
import net.tsz.afinal.annotation.sqlite.Table;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;

@Table(name = "tb_searchrecord")
public class SearchRecord implements Parcelable {

	@Id
	private int id;
	@Property
	private String keyWord;
	@Property
	private int times;
	@Property
	private int currentUID;
	

	public int getCurrentUID() {
		return currentUID;
	}

	public void setCurrentUID(int currentUID) {
		this.currentUID = currentUID;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getKeyWord() {
		return keyWord;
	}

	public void setKeyWord(String keyWord) {
		this.keyWord = keyWord;
	}

	public int getTimes() {
		return times;
	}

	public void setTimes(int times) {
		this.times = times;
	}

	public SearchRecord() {

	}
	public SearchRecord(String keyword,int times) {
		this.keyWord = keyword;
		this.times = times;
		this.currentUID = IAuth.getInstance().loadUserInfo().getUid();
	}

	public SearchRecord(Parcel source) {
		keyWord = source.readString();
		times = source.readInt();
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int arg1) {
		dest.writeString(keyWord);
		dest.writeInt(times);
	}

	public static final Parcelable.Creator<SearchRecord> CREATOR = new Creator<SearchRecord>() {

		@Override
		public SearchRecord[] newArray(int size) {
			return new SearchRecord[size];
		}

		@Override
		public SearchRecord createFromParcel(Parcel source) {
			return new SearchRecord(source);
		}
	};
	
	public boolean equals(Object o) {
		if(o instanceof SearchRecord){
			SearchRecord word = (SearchRecord)o;
			if(word.keyWord!=null&&word.keyWord.equals(keyWord)){
				return true;
			}
		}
		return false;
	};

}
